package cate.common.table.guide;

import cate.common.table.ESheet;

public class MainlineSheet extends ESheet<MainlineRow> {

    /**
     * 第一个主线任务
     */
    public MainlineRow first;

    @Override
    public String getSheetName() {
        return "主线任务";
    }

    @Override
    protected void onRowCreated(MainlineRow row) {
        if (first == null) {
            first = row;
        }
    }

    @Override
    public void decode() {
        int n = 1;
        int id = first.id;
        while (true) {
            MainlineRow row = this.map.get(id);
            if(row == null) {
                break;
            }
            row.index = n++;
            id = row.nextId;
            if(n > this.list.size()) {
                break;
            }
        }
    }
}
